import mx.events.EventDispatcher;
import mx.utils.Delegate;
import com.dmotiko.general.*

class DataXMLLoader {
	
	public static var DATA_LOADED:String = "dataxmlloader_dataloaded";
	
	public var addEventListener:Function;
	public var removeEventListener:Function;
	public var dispatchEvent:Function;
	
	private var data:Object;
	private var xml:XML;
		
	public function DataXMLLoader(){
		EventDispatcher.initialize(this);
	}
	public function run(src){
		var root = this;
		xml = new XML();
		xml.ignoreWhite = true;
		xml.load(src);
				
		xml.onLoad = function(){
			root.parserFunction();
		}
		
	}
	
	private function parserFunction(){
		// call to loadEnd();
		return;
	}
	
	private function loadEnd(){
		dispatchEvent( { target: this, type: DATA_LOADED, data: this.data } );
	}
	
}